import http from "./http";
const app = getApp();
const { get, post, put, api, deletes, apioss } = http;

export const apiOss = apioss;

export const Api = api;

//登录
export const logins = (e) => {
  return http
    .get("/gzh/art/login", {
      ...e,
      noLogin: true,
    })
    .then((res) => res.data);
};

//获取用户信息
export const artUser = (e) => {
  return http.get("/gzh/art/trainee", e).then((res) => res.data);
};

//获取用户信息
export const artUserById = (id) => {
  return http.get(`/gzh/art/trainee/${id}`).then((res) => res.data);
};

//获取学校list信息
export const getSchoolList = (e) => {
  return http.get("/gzh/art/artSchool/findByGzhAppid", e).then((res) => res.data);
};
//切换学校
export const schoolSwitch = (e) => {
  return http.get("/gzh/art/toggleSchool", e).then((res) => res.data);
};

//获取学校具体信息
export const getSchoolInfo = (e) => {
  return http.get("/gzh/art/artSchool/findByGzhAppidAndSchoolId", e).then((res) => res.data);
};
//获取科目信息
export const getCourseList = (e) => {
  return http.get("/gzh/art/subject/list", e).then((res) => res.data);
};
//获取所有课程
export const getAllCourseList = (e) => {
  return http.get("/gzh/art/course/getAll", e).then((res) => res.data);
};
//获取科目中课程信息
export const getCourseDetailInfo = (id) => {
  return http.get(`/gzh/art/subject/${id}`).then((res) => res.data);
};
//获取学员优秀作品列表
export const getWorksList = (e) => {
  return http.get(`/gzh/art/traineeWorks/outstandingWorks`,e).then((res) => res.data);
};
//新增预约试听
export const addAppointListen = (e) => {
  return http.post(`/gzh/art/audition`,e).then((res) => res.data);
};
//查询预约试听列表
export const getAppointListen = (e) => {
  return http.get(`/gzh/art/audition/findByTraineeId`,e).then((res) => res.data);
};
//查询科目中课程列表
export const getCourseDetailList = (e) => {
  return http.get(`/gzh/art/course/all`,e).then((res) => res.data);
};
//查询优惠券列表
export const getCouponList = (e) => {
  return http.get(`/gzh/art/traineeCoupon/findByTraineeId`,e).then((res) => res.data);
};
//查询学员优惠券列表
export const getStudyCouponList = (id) => {
  return http.get(`/gzh/art/traineeCoupon/${id}`).then((res) => res.data);
};

//验证码请求
export const getCodeRequest = (e) => {
  return http.get(`/gzh/art/trainee/sendAliyun`,e).then((res) => res.data);
};
//学员绑定
export const studentBingding = (e) => {
  return http.get(`/gzh/art/trainee/bindGzhUser`,e).then((res) => res.data);
};
//授课老师列表
export const teacherTeam = (e) => {
  return http.get(`/gzh/art/user/list`,e).then((res) => res.data);
};
//查询公告列表
export const getNoticeList = (e) => {
  return http.get(`/gzh/artweb/notice/list`,e).then((res) => res.data);
};
//获取公告详细信息
export const getNoticeDetail = (id) => {
  return http.get(`/gzh/artweb/notice/${id}`).then((res) => res.data);
};
//查询全部积分物品类型
export const getpointsItemType = (e) => {
  return http.get(`/gzh/art/pointsItemType/all`,e).then((res) => res.data);
};
//查询积分物品列表
export const pointsItemList = (e) => {
  return http.get(`/gzh/art/pointsItem/list`,e).then((res) => res.data);
};
//获取积分物品详细信息
export const getPointsItemDetail = (id) => {
  return http.get(`/gzh/art/pointsItem/${id}`).then((res) => res.data);
};
//查询本人积分购物车列表
export const getPointsCart = (e) => {
  return http.get(`/gzh/art/pointsCart/list`,e).then((res) => res.data);
};

//新增积分购物车
export const addPointsCart = (e) => {
  return http.post(`/gzh/art/pointsCart`,e).then((res) => res.data);
};
//新增积分物品兑换订单
export const getPointsOrder = (e) => {
  return http.post(`/gzh/art/pointsOrder`,e).then((res) => res.data);
};
//修改积分购物车
export const modifyPointsCar = (e) => {
  return http.put(`/gzh/art/pointsCart`,e).then((res) => res.data);
};
//修改积分购物车
export const deletePointsCar = (ids) => {
  return http.deletes(`/gzh/art/pointsCart/${ids}`).then((res) => res.data);
};
//查询积分物品兑换订单列表(根据status查询不同列表0待领取1已领取不能为空）
export const getPointsOrderList = (e)=> {
  return http.get(`/gzh/art/pointsOrder/list`,e).then((res) => res.data);
};
//删除积分物品兑换订单
export const deletePointsOrderList = (ids)=> {
  return http.deletes(`/gzh/art/pointsOrder/${ids}`,).then((res) => res.data);
};
//删除积分物品兑换订单
export const pointsSettingsList = (e)=> {
  return http.get(`/gzh/art/pointsSettings/list`,e).then((res) => res.data);
};
//查询学员作品列表(学员列表接口需传入学员Id)
export const getTraineeWorksList = (e) => {
  return http.get(`/gzh/art/traineeWorks/findByTraineeId`,e).then((res) => res.data);
};
//查询作品积分活动列表
export const pointsEventsWorks = (e) => {
  return http.get(`/gzh/art/pointsEventsWorks/list`,e).then((res) => res.data);
};
//查询学员积分记录列表
export const pointsRecordList = (e) => {
  return http.get(`/gzh/art/pointsRecord/list`,e).then((res) => res.data);
};
//我的报名课程
export const getApplicationCourseList = (e) => {
  return http.get(`/gzh/art/traineeCourse/findByTraineeIdZc`,e).then((res) => res.data);
};
//销课明细
export const getCourseSalesDetailsList = (e) => {
  return http.get(`/gzh/art/courseCalendarTrainee/list`,e).then((res) => res.data);
};
//我要请假
export const traineeAskLeave = (e) => {
  return http.post(`/gzh/art/traineeAskLeave`,e).then((res) => res.data);
};
//我要请假
export const traineeAskLeaveList = (e) => {
  return http.get(`/gzh/art/traineeAskLeave/findByTraineeId`,e).then((res) => res.data);
};
//查询课堂瞬间列表
export const getClassroomMoment = (e) => {
  return http.get(`/gzh/art/classroomMoment/list`,e).then((res) => res.data);
};
//修改学员
export const traineeUpdate = (e) => {
  return http.put(`/gzh/art/trainee`,e).then((res) => res.data);
};
//查询已绑定学员
export const findByBindTraineeList = (e) => {
  return http.get(`/gzh/art/trainee/findByBindTrainee`,e).then((res) => res.data);
};
//学员解绑
export const unBindAction = (e) => {
  return http.get(`/gzh/art/trainee/unBind`,e).then((res) => res.data);
};
//查询券活动列表（需要传不同的type来查询不同券活动）
export const getEventsCoupon = (e) => {
  return http.get(`/gzh/art/eventsCoupon/list`,e).then((res) => res.data);
};
//我的约课列表
export const schoolTraineeAboutClass = (e) => {
  return http.get(`/gzh/art/schoolTraineeAboutClass/list`,e).then((res) => res.data);
};

//选课列表
export const getEventsSetMeal = (e) => {
  return http.get(`/gzh/art/eventsSetMeal/list`,e).then((res) => res.data);
};

//在线报名列表
export const getEventsMeal = (e) => {
  return http.get(`/gzh/art/events/list`,e).then((res) => res.data);
};
//校外报名
export const schoolOutsideSignUp = (e) => {
  return http.get(`/gzh/art/eventsOrder/schoolOutsideSignUp`,e).then((res) => res.data);
};
//校内报名
export const schoolOnSignUp = (e) => {
  return http.get(`/gzh/art/eventsOrder/schoolOnSignUp`,e).then((res) => res.data);
};
//查询报名订单列表
export const eventsOrder = (e) => {
  return http.get(`/gzh/art/eventsOrder/list`,e).then((res) => res.data);
};
//未绑定学员领券
export const drawCouponSchoolOutside = (e) => {
  return http.get(`/gzh/art/eventsCoupon/drawCouponSchoolOutside`,e).then((res) => res.data);
};
//已绑定学员领券
export const drawCouponSchoolOn = (e) => {
  return http.get(`/gzh/art/eventsCoupon/drawCouponSchoolOn`,e).then((res) => res.data);
};
//选课列表
export const aboutClassCalendarList = (e) => {
  return http.get(`/gzh/art/classCalendar/aboutClassCalendarList`,e).then((res) => res.data);
};
//新增约课
export const schoolTraineeAboutClassRequst = (e) => {
  return http.get(`/gzh/art/schoolTraineeAboutClass`,e).then((res) => res.data);
};

//扫码绑定学员
export const traineeBindWx = (e) => {
  return http.get(`/web/art/wxbind/traineeBindWx`,e).then((res) => res.data);
};
//扫码绑定老师
export const userBindWx = (e) => {
  return http.get(`/web/art/wxbind/userBindWx`,e).then((res) => res.data);
};
//查询老师信息
export const userById = (e) => {
  return http.get(`/gzh/art/user/byId`,e).then((res) => res.data);
};
//公众号请假选择排课
export const findByCourseId = (e) => {
  return http.get(`/gzh/art/classCalendar/findByCourseId`,e).then((res) => res.data);
};
//获取签名
export const getSignature = (e) => {
  return http.get(`/gzh/art/trainee/getSignature`,e).then((res) => res.data);
};
//学员绑定
export const bindTrainee = (e) => {
  return http.get(`/gzh/art/trainee/bindTrainee`,e).then((res) => res.data);
};
//学员切换
export const toggleTrainee = (e) => {
  return http.post(`/gzh/art/toggleTrainee?traineeId=${e}`).then((res) => res.data);
};
